package com.spittr.config;


import java.util.ArrayList;
import java.util.List;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.core.GrantedAuthority;
import com.spittr.model.SecurityUser;

/**
 * 自定义用户认证
 * @author zoe
 * 2017年1月17日
 */
public class SecurtityUserDetailService implements UserDetailsService {

	@Override
	public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException {
		
		List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
		//模拟admin权限
		authorities.add(new SimpleGrantedAuthority("ROLE_ADMIN"));
		//模拟admin用户
		SecurityUser securityUser = new SecurityUser("admin","admin",authorities);
		return securityUser;
	}

}
